package org.example;

import java.util.ArrayList;


public class Reducer {
    public void reduce(String key, ArrayList<String> values,Context context){
        double sum = 0;
        String url = "";
        double pr = 0;
        for(String val:values) {
            if (!val.contains("_")) {
                sum = sum + Double.valueOf(val);
            }else{
                url = val;
            }
            pr = 0.15+0.85*sum;
        }
        String str = String.format("%.3f",pr);
        context.write(key,str+" "+url);
    }
}
